<?

if ($c = stack('name')) {

	$_id_component	= $DATA['components'][$c]['id'];			//	list id value
	$_id_data		= D_MB_DATA;			//	meta id value
	$_id_meta		= D_MB_META;			//	meta id value
	
	$_crit = "id_data=$_id_data AND id_parent=$_id_component AND attr & ".AA_VISIBLE;

	$s = array_extend( array('path' => 'album', 'tn' => FP_TN_DIR, 'w' => 800, 'h' => 600, 'tnw' => 96, 'tnh' => 96, 'gw' => 96, 'gh' => 96, 'caption' => ''), $DATA['components'][$c]['settings']);

	$s['path'] = FP_UPLOAD_PATH."$s[path]/";

	$DATA['components'][$c]['data'] = array_mark_bounds( datafetch_array('db_list', array('table' => tb('data'), 'where' => "$_crit",	'order' => 'id_index', 'index' => 'id' )));

	foreach($DATA['components'][$c]['data'] as $k => $v) {
		$DATA['components'][$c]['data'][$k] = array_merge($v, datafetch_array('meta', $_id_meta, $k, $CONTEXT['lang']));
		$DATA['components'][$c]['data'][$k]['image'] = checkImage($s['path'], $k);
	}
//debug($DATA['components'][$c]['data']);

//	$DATA['components'][$c]['data'] = datafetch_array('gallery', FP_UPLOAD_PATH.$DATA['components'][$c]['settings']['path']);	// load existing images list
	
	unstack();
}

?>